package Text;

import java.util.Arrays;
import  java.util.Scanner;
public class Graph {
  char[] vertex;
  int[][] matrix;

  public  static final int N=65535;
    public Graph(char[] vertex, int[][] matrix) {
        this.vertex = vertex;
        this.matrix = matrix;
    }

    public void showgraph(){
       for(int[] m:matrix){
           System.out.println(Arrays.toString(m));
       }
    }

    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        /*System.out.println("请输入节点个数");
        int n=scanner.nextInt();
        System.out.println("请输入节点");*/
//        char[] vertex=new char[n];
//        int[][] matrix=new int[n][n];

        char[] vertex={'A','B','C','D','E','F','G'};
        int[][] matrix=new int[vertex.length][vertex.length];

        matrix[0]= new int[]{N,5,7,N,N,N,2};
        matrix[1]= new int[]{5,N,N,9,N,N,3};
        matrix[2]= new int[]{7,N,N,N,8,N,N};
        matrix[3]= new int[]{N,9,N,N,N,4,N};
        matrix[4]= new int[]{N,N,8,N,N,5,4};
        matrix[5]= new int[]{N,N,N,4,5,N,6};
        matrix[6]= new int[]{2,3,N,N,4,6,N};

        Graph graph = new Graph(vertex, matrix);
        graph.showgraph();

        visitedvertex vv = new visitedvertex(6, vertex.length);
        vv.show();
        vv.update(graph,6);
        vv.show();
        for (int i = 1; i <vertex.length ; i++) {
            int index=vv.updateArr();
            vv.update(graph,index);
        }
        vv.show();
    }
}
